package util;

public class Util {

    public static int[] DecToBi(int n, int dec) {
        int[] retDat = new int[n];
        for (int i = 0; i < n; i++, dec /= 2)
            retDat[i] = dec % 2 == 0 ? 0 : 1;
        return retDat;
    }

    public static int BiToDec(int[] bi){
        int retDat = 0;
        int weight = 1;
        for(int i = 0; i < bi.length; i ++, weight <<= 1)
            if (bi[i] == 1) retDat += weight;
        return retDat;
    }

    public static int[] divide(int dec, int n) {
        int[] retDat = new int[n];
        for(int j = 0; j < n ; j ++){
            retDat[j] = dec % 10;
            dec /= 10;
        }
        return retDat;
    }

    public static void main(String[] args){
        int[] test = Util.divide(73957123,5);
        for(int i = 0; i < test.length; i ++)
            System.out.println(test[i]);
    }
}
